/*
2022-5-1
https://www.acwing.com/problem/content/4416/
*/ 
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    k=5-k;
    int x,ans=0;
    while(n--)
    {
        cin>>x;
        if(x<=k) ans++;
    }
    
    cout<<ans/3<<endl;
    
    return 0;
}
